package com.wanmait.schedule.manageController;

import com.wanmait.schedule.entity.Menu;
import com.wanmait.schedule.service.MenuService;
import com.wanmait.schedule.util.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/Manage")
public class MenuContext {
    @Resource
    private MenuService menuService;
    //将隐藏的菜单恢复
    @GetMapping("/Recover")
    public void MenuRecover(Integer id){
        menuService.RecoverMenu(id);
    }
    @GetMapping("/Update")//修改菜单的名字
    public void MenuUpdate(Integer id,String username){
        menuService.UpdateMenu(id,username);
    }
    @GetMapping("/UserMenus")//用户看到的菜单
    public Result UserMenus(){
        List<Menu> usermenus = menuService.UserMenus();
        return Result.success(usermenus);
    }
}
